#include "Tcpserver.hpp"
#include "Servercal.hpp"
#include <iostream>
#include <memory>
#include <string>



using namespace std;

void Useag(char* argv)
{
    cout<<"you should input like this:"<<argv<<" xxxx(port)"<<endl;
}

int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        Useag(argv[0]);
        exit(0);
    }
    uint16_t port=stoi(argv[1]);
    Servercal cal;
    auto callback=[&cal](auto&& arg)
    {
        return cal.Calculator(forward<decltype(arg)>(arg));    
    };
    std::unique_ptr<TcpServer> Tcp(new TcpServer(port,callback));
    Tcp->Initserver();
    Tcp->Start();
    return 0;
}